﻿Imports System
Imports System.ComponentModel
Imports System.Drawing.Design
Imports System.Windows.Forms

Namespace System.Workflow.ComponentModel.Design
    Friend NotInheritable Class ImageBrowserEditor
        Inherits UITypeEditor
        ' Methods
        Public Overrides Function EditValue(ByVal context As ITypeDescriptorContext, ByVal provider As IServiceProvider, ByVal value As Object) As Object
            Dim dialog As New OpenFileDialog { _
                .AddExtension = True, _
                .DefaultExt = "*.wtm", _
                .CheckFileExists = True, _
                .Filter = DR.GetString("ImageFileFilter", New Object(0  - 1) {}) _
            }
            If (dialog.ShowDialog = DialogResult.OK) Then
                Return dialog.FileName
            End If
            Return value
        End Function

        Public Overrides Function GetEditStyle(ByVal context As ITypeDescriptorContext) As UITypeEditorEditStyle
            Return UITypeEditorEditStyle.Modal
        End Function

    End Class
End Namespace

